//
//  YCNavigationViewController.m
//  lianganyuchu
//
//  Created by iMac on 17/2/20.
//  Copyright © 2017年 杭州桑缇电子商务有限公司. All rights reserved.
//

#import "YCNavigationViewController.h"

@interface YCNavigationViewController ()

@end

@implementation YCNavigationViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    CGRect frame = self.navigationBar.frame;
    _alphaView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, frame.size.width, frame.size.height+20)];
    _alphaView.backgroundColor = WHITE_COLOR;
    //[_alphaView addShadow];
    
    [[UINavigationBar appearance] setBackgroundImage:[[UIImage alloc] init] forBarPosition:UIBarPositionAny barMetrics:UIBarMetricsDefault];
    [[UINavigationBar appearance] setShadowImage:[[UIImage alloc] init]];
    [self.view insertSubview:_alphaView belowSubview:self.navigationBar];
}
-(void)setAlph:(double)value{
    [UIView animateWithDuration:1.0 animations:^{
        _alphaView.alpha = value;
    } completion:^(BOOL finished) {
    }];
}

-(void)setMainNaviVC
{
    _alphaView.backgroundColor = MAIN_COLOR;
    _alphaView.layer.shadowPath=nil;
    _alphaView.layer.shadowOpacity = 0;
    [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;
    
    NSDictionary *dict = @{NSForegroundColorAttributeName : WHITE_COLOR, NSFontAttributeName : [UIFont LightFontOfSize:18]};
    self.navigationBar.titleTextAttributes = dict;
}
-(void)setCommonNaviVC
{
    _alphaView.backgroundColor = WHITE_COLOR;
    [_alphaView addShadow];
    [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleDefault;
    
    NSDictionary *dict = @{NSForegroundColorAttributeName : MAIN_COLOR,
                           NSFontAttributeName : [UIFont LightFontOfSize:18]};
    self.navigationBar.titleTextAttributes = dict;
}
-(void)setNaviHidden:(BOOL)hidden
{
    self.navigationBarHidden=hidden;
    _alphaView.hidden=hidden;
    if (hidden) {
        [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;
    }
}

@end
